﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace de.wolfmarco.pas.Shared.MessageBoxes
{
    public static class PASMessageBox
    {
        public static void ShowException(Exception ex)
        {
            MessageBox.Show(
                ex.Message + "\n\n" + ex, 
                "Fehlermeldung",
                MessageBoxButton.OK,
                MessageBoxImage.Error
                );
        }

        public static MessageBoxResult ShowMessageBox( string messageBoxText, string caption, MessageBoxButton button, MessageBoxType messageBoxType )
        {
            switch( messageBoxType )
            {
                case MessageBoxType.Question:
                    return MessageBox.Show( messageBoxText, caption, button, MessageBoxImage.Question );
                case MessageBoxType.Warning:
                    return MessageBox.Show(messageBoxText, caption, button, MessageBoxImage.Warning);
                default:
                    throw new Exception( "Unknown MessageBoxType at de.wolfmarco.pas.Shared.MessageBoxes.PASMessageBox" );
            }
        }

        public static MessageBoxResult ShowMessageBox(GlobalMessageBoxType messageBoxType)
        {
            switch (messageBoxType)
            {
                case GlobalMessageBoxType.SavingChanges:
                    return MessageBox.Show("Möchten Sie die Änderungen speichern?", "Änderungen speichern?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
                default:
                    throw new Exception("Unknown MessageBoxType at de.wolfmarco.pas.Shared.MessageBoxes.PASMessageBox");
            }
        }
    }

    public enum MessageBoxType
    {
        Question,
        Warning
    }

    public enum GlobalMessageBoxType
    {
        SavingChanges
    }
}
